
//减压器（reducer）
//state 组件中的状态
//action：就是你要执行的操作
export default (state, action)=>{

    switch(action.type){
        case "jia": return  {num:state.num+1};
        case "jian": return  {num:state.num-1};
        case "cheng": return  {num:state.num*2};
        case "chu": if(state.num%2==0){
              return  {num:state.num/2}
        }else{
            return {num:state.num}
        };
        default: return {num:state.num};
    }
}